package homework;

import java.util.Properties;

public class PropertiesSave {
    public static void main(String[] args) {
        String url = "http://www.lovo.com/index?name=aaaaaa&age=20&gender=男";
        Properties properties = new Properties();
        String str = url.substring(url.indexOf('?') + 1);//拿到？后面的字符串
        String[] strArr = str.split("&");//用 & 分割成字符串数组
        for (int i = 0; i < strArr.length; i++) {
            String[] tmpArr = strArr[i].split("=");//用 = 分割子数组,得到键值对
            properties.put(tmpArr[0], tmpArr[1]);//将键值对放入properties
        }
        //调用方法保存properties
//        FileUtil.saveProperties("1.properties",properties);
        //提取properties
        Properties properties1 = FileUtil.loadProperties("1.properties");
        System.out.println(properties1);
    }
}
